LoadScene = {}
LoadSceneFunc = {}
LoadSceneFunc.__index = LoadSceneFunc
setmetatable(LoadScene, LoadSceneFunc)

LoadSceneFunc.showLoadingScene = function(self)
  if self.node~=nil then
    return
  end
  CCSpriteFrameCache:sharedSpriteFrameCache():addSpriteFramesWithFile("loadingbar.plist")
  
  local l = CCLayer:create()
  l:registerScriptTouchHandler(LoadSceneFunc.onTouchLoadingLayer, false, -1111, true)
  l:setTouchEnabled(true)
  
  local sp = CCSprite:create("progress_bk1.png")
  l:addChild(sp)

  local lb = CCLabelTTF:create("加载中...", "Helvetica", 28)
  lb:setPosition(ccp(0,30))
  l:addChild(lb)

  sp = CCSprite:createWithSpriteFrameName("loadingBar0009.png")
  sp:setPosition(ccp(0, -30))
  l:addChild(sp)

  local sc = CCDirector:sharedDirector():getRunningScene()
  local ac = ActionUtil.createAction("loadingbar.plist", 0.02, "")
  sp:runAction(CCRepeatForever:create(ac)) 
  l:setPosition(ccp(480, 200))
  sc:addChild(l, 111)
  
  self.node = l
  --sp:runAction(ac) 
end

LoadSceneFunc.removeLoadingScene = function(self)
  local sc = CCDirector:sharedDirector():getRunningScene()
  sc:removeChild(self.node, true)
  self.node = nil
end
LoadSceneFunc.onTouchLoadingLayer = function(event, x, y)
  return true
end
